<template>
  <div>
    <el-container>
      <el-header v-show="show">
        <div class="header_box_container">
          <div class="left_box_container">
            <b>UNI-ADMIN</b>
          </div>
          <div class="right_box_container">
            <el-menu
              class="el-menu-demo"
              mode="horizontal"
              background-color="#545c64"
              text-color="#fff"
              active-text-color="#ffd04b"
              router
            >
              <el-menu-item index="/page">首页</el-menu-item>
              <el-menu-item index="/commodity">商品</el-menu-item>
              <el-menu-item index="/order">订单</el-menu-item>
              <el-menu-item index="/vip">会员</el-menu-item>
              <el-menu-item index="/setup">设置</el-menu-item>
            </el-menu>
          </div>
        </div>
      </el-header>
      <router-view></router-view>
    </el-container>
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: false,
    };
  },
  watch: {
    $route: {
      handler(newval, oldval) {
        console.log(newval, oldval);
        if (newval.path == "/login") {
          this.show = false;
        } else {
          this.show = true;
        }
      },
    },
  },
};
</script>
<style lang="scss">
.el-header,
.el-footer {
  background-color: #545c64;
  color: #333;
  text-align: center;
  line-height: 60px;
}
.header_box_container {
  width: 100%;
  display: inline-flex;
  justify-content: space-between;
}
.left_box_container {
  width: 10%;
  b {
    font-size: 20px;
    color: #fff;
  }
}
.right_box_container {
  width: 30%;
}
.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
  // line-height: 200px;
  height: 100vh;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
  text-align: center;
  // line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>